package utils;

import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;

/**
 * @author pzy
 */
public class GuavaUtils {

    /**
     * 连接器
     */
    private static final Joiner joiner = Joiner.on(',').skipNulls();

    private static final Splitter splitter = Splitter.on(",").trimResults().omitEmptyStrings();

    public static void main(String[] args) {
        String join = joiner.join(Lists.newArrayList("a", null, "b"));
        System.out.println("join = " + join);

        for (String tmp : splitter.split("a,  ,b,,")) {
            System.out.println("|" + tmp + "|");
        }

        Preconditions.checkNotNull(null, "不能为空");

    }
}
